
//
// 120112 - AH - (Huset) Created.
// 120407 - AH - (Midtun) Name property.
//

package org.soekrat.engine.motor.passingstrategies;

import org.soekrat.engine.motor.Motor;
import org.soekrat.engine.orb.Soekrat2Orb;
import org.soekrat.engine.wheel.ontology.Ontology;
import org.soekrat.engine.wheel.retrieval.RetrievalEvent;

/**
 * <p>
 *   Base class for objects that decides the next ontology to pass the
 *   {@link Soekrat2Orb} to.
 * </p>
 * @author Laetitia Le Chatton (LLC)
 * @author Arne Halvorsen (AH)
 */
public abstract class PassingStrategy
{
  private final String m_name;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param name Name of strategy.
   */
  protected PassingStrategy(String name)
  {
    if (name==null)
    {
      throw new NullPointerException("name");
    }
    
    m_name=name;
  }
  
  /**
   * <p>
   *   Gets name of strategy.
   * </p>
   * @return Name.
   */
  public String getName(){ return m_name; }
  
  /**
   * <p>
   *   Gets the next ontology to pass the 
   *   {@link Soekrat2Orb} to. 
   * </p>
   * @param ce    {@code ConversationElement}.
   * @param motor {@link Motor} driving the retrieval.
   * @return Ontology or {@code null} if no more ontologies to pass to.
   */
  public abstract Ontology getOntology(Motor motor, Soekrat2Orb ce, 
    RetrievalEvent re);
  
  /**
   * <p>
   *   Invoked when strategy have to be in 'start' state.
   * </p>
   * <p>
   *   Default implementation is to do nothing so state less strategies do not
   *   have to override.
   * </p>
   */
  public void reset(){}
  
} 
